﻿using System;
using System.Drawing;
using ImageProvider;
using System.IO;

namespace ImageLib
{
    class Program
    {
        static void Main()
        {
            var provider = new ImageService().Provider;
            var john = new ImageUser("John", provider);
            var marry = new ImageUser("Marry", provider);
            var peter = new ImageUser("Peter", provider);

            Console.WriteLine();

            var path = Environment.CurrentDirectory;
            var index = path.LastIndexOf(@"bin\debug", StringComparison.OrdinalIgnoreCase);
            if (index != -1)
            {
                path = path.Remove(index);
            }

            var image = Image.FromFile(Path.Combine(path, @"Test Images\accept.png"));
            john.UploadImage("accept.png", image);

            image = Image.FromFile(Path.Combine(path, @"Test Images\add.png"));
            marry.UploadImage("add.png", image);

            image = Image.FromFile(Path.Combine(path, @"Test Images\anchor.png"));
            peter.UploadImage("anchor.png", image);

            Console.WriteLine();

            peter.DownloadImage("anchor.png");
            peter.DownloadImage("accept.png", john.Root);

            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
        }
    }
}
